unit dgAddLabel ;

interface

uses
   Windows,
   Messages,
   SysUtils,
   Variants,
   Classes,
   Graphics,
   Controls,
   Forms,
   Dialogs,
   SpTBXControls,
   StdCtrls,
   SpTBXEditors,
   TBXDkPanels,
   TBXExtItems,
   TB2Item,
   TBX,
   SpTBXItem,
   TB2ExtItems,
   TB2Dock,
   TB2Toolbar,
   uBasic,
   TntStdCtrls,
   uObjects,
   GDIPAPI,
   GDIPOBJ ;

type
   TdlgAddLabel = class( TForm )
      Panel : TSpTBXPanel ;
      btOK : TSpTBXButton ;
      btCancel : TSpTBXButton ;
      SpTBXGroupBox3 : TSpTBXGroupBox ;
      edLabel : TSpTBXEdit ;
      procedure btOKClick( Sender : TObject ) ;
      procedure FormCreate( Sender : TObject ) ;
   private
      fLabel : TMedaLabel ;
      procedure SetLabel( const Value : TMedaLabel ) ;
      procedure SetTitle( const Value : string ) ;
   public
      property Title : string write SetTitle ;
      property mLabel : TMedaLabel read fLabel write SetLabel ;
   end ;

implementation

{$R *.dfm}
// TMedaDir = ( drEast, drNE, drNorth, drNW, drWest, drSW, drSouth, drSE ) ;

const
   DirectionIndex   : array[ TMedaDir ] of integer = (
      1, -1, 0, -1, 3, -1, 2, -1
      ) ;
   IndexDirection   : array[ 0..3 ] of TMedaDir = (
      drNorth, drEast, drSouth, drWest
      ) ;

   { TdlgAddPort }

procedure TdlgAddLabel.FormCreate( Sender : TObject ) ;
begin
   fLabel := nil ;
   Caption := ' New Label' ;
end ;

procedure TdlgAddLabel.SetLabel( const Value : TMedaLabel ) ;
begin
   fLabel := Value ;
   if assigned( fLabel ) then begin
      edLabel.Text := fLabel.Parent.Name ;
   end ;
end ;

procedure TdlgAddLabel.SetTitle( const Value : string ) ;
begin
   Caption := Value ;
end ;

procedure TdlgAddLabel.btOKClick( Sender : TObject ) ;
begin
   if assigned( fLabel ) then begin
      fLabel.Parent.Name := edLabel.Text ;
   end ;
end ;

end.

